package com.gxa.hystrix.service;

import com.gxa.hystrix.interfaces.ServiceFeignByGuaHaoTongJi;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author xyc
 * @version 1.0
 * @description GuaHaoTongJiService.java
 * @date 2021/3/24 9:19
 */
@Service
public class GuaHaoTongJiService {
    @Resource
    private ServiceFeignByGuaHaoTongJi serviceFeignByGuaHaoTongJi;

    @HystrixCommand(fallbackMethod = "chaXunDayCountError")
    public Map<String, Object> chaXunDayCount() {
        return serviceFeignByGuaHaoTongJi.chaXunDayCount();
    }
    public Map<String, Object> chaXunDayCountError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }

    @HystrixCommand(fallbackMethod = "chaXunDayPaymentError")
    public Map<String, Object> chaXunDayPayment() {
        return serviceFeignByGuaHaoTongJi.chaXunDayPayment();
    }
    public Map<String, Object> chaXunDayPaymentError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }

    @HystrixCommand(fallbackMethod = "chaXunDayPaymentByIdError")
    public Map<String, Object> chaXunDayPaymentById(String id) {
        return serviceFeignByGuaHaoTongJi.chaXunDayPaymentById( id);
    }
    public Map<String, Object> chaXunDayPaymentByIdError(String id) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }


    @HystrixCommand(fallbackMethod = "chaXunMonthCountError")
    public Map<String, Object> chaXunMonthCount() {
        return serviceFeignByGuaHaoTongJi.chaXunMonthCount();
    }
    public Map<String, Object> chaXunMonthCountError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }
    @HystrixCommand(fallbackMethod = "chaXunMonthPaymentError")
    public Map<String, Object> chaXunMonthPayment() {
        return serviceFeignByGuaHaoTongJi.chaXunMonthPayment();
    }
    public Map<String, Object> chaXunMonthPaymentError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }
    @HystrixCommand(fallbackMethod = "chaXunMonthPaymentRecordError")
    public Map<String, Object> chaXunMonthPaymentRecord() {
        return serviceFeignByGuaHaoTongJi.chaXunMonthPaymentRecord();
    }
    public Map<String, Object> chaXunMonthPaymentRecordError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }
    @HystrixCommand(fallbackMethod = "chaXunMonthCountRecordError")
    public Map<String, Object> chaXunMonthCountRecord() {
        return serviceFeignByGuaHaoTongJi.chaXunMonthCountRecord();
    }
    public Map<String, Object> chaXunMonthCountRecordError() {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }
    @HystrixCommand(fallbackMethod = "chaXunMonthPaymentByIdError")
    public Map<String, Object> chaXunMonthPaymentById(String id) {
        return serviceFeignByGuaHaoTongJi.chaXunMonthPaymentById( id);
    }
    public Map<String, Object> chaXunMonthPaymentByIdError(String id) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }

    @HystrixCommand(fallbackMethod = "checkError")
    public void check() {
        return;
    }
}
